home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
Games
/
Tetris
/
Source
/
Piece.h
< prev
next >
Wrap
Text File
|
1972-08-28
|
1KB
|
69 lines
#import <objc/Object.h>
#define MAX_SHAPE_SIZE 4
#define PIECE_INFO_NULL (struct pieceInfo *)0
#define NUM_BITMAPS 4
struct shape {
unsigned char table[4][4];
unsigned char bounds[4];
unsigned char points[4];
};
struct pieceInfo {
id bitmap;
int shape;
int rotation;
};
@interface Piece:Object
{
int curRow, curCol; // The Block's position
id bitmap; // The image used to build the block
unsigned char *currentPiece;
struct shape *currentShape;
int shapenum; // The Shape that we are currently dropping
int currentRotation;
int dropPoints; // Bonus points for dropping the piece
NXSize blockSize;
NXSize intercell;
NXRect invalidRect;
BOOL viewVarsInited;
id anmShape;
id anmBackground; // The animation background
struct shape shapes[7];
id blockImage[NUM_BITMAPS]; // Holds the id for each block image.
}
- init;
- draw:sender;
- (BOOL)reset:sender piece:(struct pieceInfo *)info;
- newPiece;
- (struct pieceInfo *)pieceInfo;
- setPiece:(struct pieceInfo *)info;
- (BOOL)legalMove:sender :(int)row :(int)column rotation:(int)rotation;
- left:sender;
- right:sender;
- getInvalidRect:(NXRect *)aRect for:sender;
- point:(NXPoint *)thePoint for:(int)row :(int)column;
- (int)points;
- getBlockSize:(NXSize *) size;
- getBlockImage:(int) blockNum;
- drop:sender;
- (BOOL)down:sender;
- turn:sender;
- stick:sender;
- (int)getCurRow;
- free;
@end